<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String appid = request.getParameter("sappid");
%>
<!DOCTYPE html>
<html>
<head>
    <title>专家服务管理</title>
    <%@ include file="../common/meta.jsp" %>
    <%@ include file="../common/common-body.jsp" %>
    <script src="${ctx}/js/common/common-body.js?t=${now}"></script>
    <link href="${ctx}/css/common-body.css?t=${now}" rel="stylesheet">
    <link href="${ctx}/css/page/common-list.css?t=${now}" rel="stylesheet">
    <link href="${ctx}/css/page/common-search.css?t=${now}" rel="stylesheet">
    <script type="text/javascript" src="${ctx}/js/plugins/jquery.qrcode.min.js"></script>
    <style>
    </style>
    <script>
        var appid = '<%=appid%>';
        var DataStatus = ${DataStatus};
        var PublishStatusSub = ${PublishStatusSub};
        var PushlishStatus = ${PushlishStatus};
        var searchobj = ${searchInfo};
        var searchInfo = ${searchInfo};
        var showQrCode = '${JTYS}';
    </script>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="tabs-container">
        <ul class="nav nav-tabs">
            <li class="">
            <c:if test="${not empty searchInfo && searchInfo.isOrgExist == 1}">
                <li class="">
                    <a href="${ctx}/bizApp/orgPage?isTeamExist=${not empty searchInfo ? searchInfo.isTeamExist : 1}&isDocExist=${not empty searchInfo ? searchInfo.isDocExist : 1}" aria-expanded="true">服务机构</a>
                </li>
            </c:if>
            <c:if test="${not empty searchInfo && searchInfo.isTeamExist == 1}">
                <li class="">
                    <a href="${ctx}/bizApp/teamPage?isOrgExist=${not empty searchInfo ? searchInfo.isOrgExist : 1}&isDocExist=${not empty searchInfo ? searchInfo.isDocExist : 1}" aria-expanded="true">机构团队</a>
                </li>
            </c:if>
            <li class="active">
                <a href="${ctx}/bizApp/docPage?isOrgExist=${not empty searchInfo ? searchInfo.isOrgExist : 1}&isTeamExist=${not empty searchInfo ? searchInfo.isTeamExist : 1}" aria-expanded="true">机构专家</a>
            </li>
        </ul>
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5><i class="fa fa-search"></i> 筛选查询</h5>
                    </div>
                    <div class="ibox-content ibox-content-search">
                        <input type="hidden" class="hideItem" name="bizCode" id="sbizCode" value="${not empty searchInfo.bizCode ? searchInfo.bizCode:''}"/>
                        <input type="hidden" class="hideItem"  name="orgCode" id="sorgCode" value="${not empty searchInfo.orgCode ? searchInfo.orgCode:''}"/>
                        <input type="hidden" class="hideItem"  name="isvPid"  id="sisvPid" value="${not empty searchInfo.isvPid ? searchInfo.isvPid:''}"/>
                        <form class="form-horizontal m-t" id="searchForm" novalidate="novalidate">
                            <div class="form-group">
                                <label class="col-sm-1 control-label">查询专家：</label>
                                <div class="col-sm-3">
                                    <input type="text" id="docName" name="docName"
                                           value="${not empty searchInfo.docName ? searchInfo.docName:''}"
                                           onkeydown="if(event.keyCode==13){doRefresh();return false;}"
                                           class="form-control" placeholder="输入专家名称" maxlength="30">
                                </div>
                                <label class="col-sm-1 control-label">发布状态：</label>
                                <div class="col-sm-2">
                                    <select name="status" id="status" class="form-control"  onchange="doRefresh()">
                                        <option value="">--请选择--</option>
                                        <c:forEach items="${PushlishStatus}" var="item">
                                            <option value="${item.key}"  ${not empty searchInfo.status && searchInfo.status == item.key ? 'selected' : '' } >${item.value}</option>
                                        </c:forEach>
                                    </select>
                                </div>
                                <label class="col-sm-1 control-label">数据状态：</label>
                                <div class="col-sm-2">
                                    <select name="dataStatus" id="dataStatus" class="form-control"  onchange="doRefresh()">
                                        <option value="">--请选择--</option>
                                        <c:forEach items="${DataStatus}" var="item">
                                            <option value="${item.key}"  ${not empty searchInfo.dataStatus && searchInfo.dataStatus == item.key ? 'selected' : '' }>${item.value}</option>
                                        </c:forEach>
                                    </select>
                                </div>
                                <div class="ibox-tools ibox-tools-search">
                                    <button type="button" class="btn btn-primary btn-outline" onclick="doRefresh()">查询</button>
                                    <button type="button" class="btn btn-primary btn-outline" onclick="clearFrom('searchForm')">重置</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-4">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                        <form id="search2">
                            <div class="row">
                                <div class="col-sm-5">
                                    <select class="form-control" name="selectType" id="selectType" onchange="selectChange();">
                                        <option value="orgName" ${not empty searchInfo.selectType && searchInfo.selectType =='orgName' ?'selected':'' }>机构名称</option>
                                        <option value="bizName" ${not empty searchInfo.selectType && searchInfo.selectType =='bizName' ?'selected':'' }>业务类型</option>
                                        <option value="isvName" ${not empty searchInfo.selectType && searchInfo.selectType =='isvName' ?'selected':'' }>服务商名称</option>
                                    </select>
                                </div>
                                <div class="col-sm-7 input-group">
                                    <input type="text" class="form-control" id="search"
                                           <c:choose>
                                            <c:when test="${not empty searchInfo.selectType && searchInfo.selectType =='bizName'  }">
                                                   name="bizName" placeholder="输入业务类型"
                                                   value="${not empty searchInfo.bizName ? searchInfo.bizName:''}"
                                            </c:when>
                                             <c:when test="${not empty searchInfo.selectType && searchInfo.selectType =='isvName'  }">
                                                   name="isvName" placeholder="输入服务商名称"
                                                   value="${not empty searchInfo.isvName ? searchInfo.isvName:''}"
                                             </c:when>
                                            <c:otherwise>
                                                    name="orgName" placeholder="输入机构名称"
                                                    value="${not empty searchInfo.orgName ? searchInfo.orgName:''}"
                                             </c:otherwise>
                                           </c:choose>
                                           onkeydown="if(event.keyCode==13){doAppRefresh();return false;}">
                                    <span class="input-group-btn">
                                        <button type="button"
                                                class="btn btn-white" onclick="doAppRefresh()">查询
                                        </button> </span>
                                </div>
                            </div>
                        </form>
                        <table class='table table-striped table-hover'
                               id="dataAppTable"
                               data-toggle="table"
                               data-url="${ctx}/bizApp/getGridBizAppPublishData?t=${now}"
                               data-height="400"
                               data-pagination="true"
                               data-side-pagination="server"
                               data-striped="true"
                               data-response-handler="handleServerResult"
                               data-query-params-type=""
                               data-query-params="getAppParams"
                               data-page-number="${not empty searchInfo.pageNo ? searchInfo.pageNo : 1}"
                               data-page-size="${defaultPageSize}"
                               data-page-list="${pageList}">
                            <thead>
                            <tr>
                                <th data-field="bizName" data-align="center" data-formatter="onceCheck" >业务类型</th>
                                <th data-field="orgName" data-align="center">机构名称</th>
                                <th data-field="isvName" data-align="center">服务商</th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
            <div class="col-sm-8">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5><i class="fa fa-table"></i> 机构专家</h5>
                        <div class="ibox-tools">
                            <c:if test="${userType == 'super' || not empty btnMap['addAppDoc']}">
                                <button class="btn btn-primary btn-outline" onclick="add()">新增</button>
                            </c:if>
                            <c:if test="${userType == 'super' || not empty btnMap['editAppDoc']}">
                                <button class="btn btn-primary btn-outline" onclick="edit()">编辑</button>
                            </c:if>
                            <c:if test="${userType == 'super' || not empty btnMap['commitAppDoc']}">
                                <button class="btn btn-primary btn-outline" onclick="beforePubish()">提交发布</button>
                            </c:if>
                            <c:if test="${userType == 'super' || not empty btnMap['revokeAppDoc']}">
                                <button class="btn btn-primary btn-outline" onclick="unPublishAppwin()">撤销发布</button>
                            </c:if>
                            <c:if test="${userType == 'super' || not empty btnMap['delAppDoc']}">
                                <button class="btn btn-primary btn-outline" onclick="deleteBatchApp()">删除</button>
                            </c:if>
                            <c:if test="${userType == 'super' || not empty btnMap['childAppDoc']}">
                                <button class="btn btn-primary btn-outline" onclick="updateChildrenBiz()">服务项</button>
                            </c:if>
                            <c:if test="${userType == 'super' || not empty btnMap['exportAppDoc']}">
                                <button class="btn btn-primary btn-outline" onclick="downaload()">导出</button>
                            </c:if>
                            <button class="btn btn-primary btn-outline" onclick="doRefresh()">刷新</button>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <table class='table table-striped table-hover'
                               id="dataTable"  data-height="360"
                               data-toggle="table"
                        <%--data-url="${ctx}/bizApp/getGridIsvData?t=${now}"--%>
                               data-pagination="true"
                               data-side-pagination="server"
                               data-striped="true"
                               data-response-handler="handleServerResult"
                               data-query-params-type=""
                               data-query-params="getParams"
                               data-page-number="${not empty searchInfo.pageNo ? searchInfo.pageNo : 1}"
                               data-page-size="${defaultPageSize}"
                               data-page-list="${pageList}">
                            <thead>
                            <tr>
                                <th data-field="status" data-width="100px" data-align="center"
                                    data-formatter="publishDataStatus"
                                >发布状态
                                </th>
                                <th data-field="dataStatus" data-width="100px" data-align="center"
                                    data-formatter="dataStatus"
                                >数据状态
                                </th>
                                <th data-field="docName" data-width="120px" data-align="center">专家名称</th>
                                <th data-field="sortNum" data-width="80px" data-align="center">排序</th>
                                <th data-field="creator" data-align="center" data-width="100px" data-formatter="formatterCreator">创建人</th>
                                <th data-field="operator" data-align="center" data-width="100px" data-formatter="formatterOperator">编辑人</th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="text-center">${companyName}</div>
            </div>
        </div>
    </div>
</div>
<div id="VueObj">

    <div id="addBizApp" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content animated bounceInRight">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 id="" style="font-weight: normal;">新增机构专家</h4>
                </div>
                <div class="modal-body modal-body-height">
                    <div class="row">
                        <label class="col-sm-3 text-right">业务类型：</label>
                        <div class="col-sm-3">{{addBizApp.bizName}}
                        </div>
                        <label class="col-sm-3 text-right">默认必备服务项：</label>
                        <div class="col-sm-3">{{addBizApp.reqBizName}}
                        </div>
                    </div>
                    <div class="row">
                        <label class="col-sm-3 text-right">机构名称：</label>
                        <div class="col-sm-3">{{addBizApp.orgName}}
                        </div>
                        <label class="col-sm-3 text-right">服务商：</label>
                        <div class="col-sm-3">{{addBizApp.isvName}}
                        </div>
                    </div>
                    <div class="row">
                        &nbsp;&nbsp;&nbsp;&nbsp;<h4><i class="fa fa-table"></i> 选择专家</h4>
                    </div>
                    <div style="border: 1px solid #e4eaec;-webkit-box-shadow:0px 3px 3px #c8c8c8 ;
-moz-box-shadow:0px 3px 3px #c8c8c8 ;
box-shadow:0px 3px 3px #c8c8c8 ;">
                        <div class="row">
                            <form action="" id="winfom">
                                <div class="row form-group">
                                    <div class="col-sm-3 text-right">一级科室：</div>
                                    <div class="col-sm-8">
                                        <div class="input-group">
                                            <input type="hidden" id="pDeptCode" name="pDeptCode" value="">
                                            <input type="text" id="pDeptName" name="pDeptName" value=""
                                                   class="form-control" maxlength="25" placeholder="输入一级科室">
                                            <div class="input-group-btn"
                                                 style="width:0px!important;border-radius:0px!important">
                                                <button type="button"
                                                        class="btn btn-default dropdown-toggle mySearchBtn"
                                                        data-toggle="dropdown">
                                                    <span class="caret"></span>
                                                </button>
                                                <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="row form-group">
                                    <div class="col-sm-3 text-right">二级科室：</div>
                                    <div class="col-sm-8">
                                        <div class="input-group">
                                            <input type="hidden" id="cDeptCode" name="cDeptCode" value="">
                                            <input type="text" id="cDeptName" name="cDeptName" value=""
                                                   class="form-control" maxlength="25" placeholder="输入二级科室">
                                            <div class="input-group-btn"
                                                 style="width:0px!important;border-radius:0px!important">
                                                <button type="button"
                                                        class="btn btn-default dropdown-toggle mySearchBtn"
                                                        data-toggle="dropdown">
                                                    <span class="caret"></span>
                                                </button>
                                                <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="row form-group">
                                    <div class="col-sm-3 text-right">所属医院：</div>
                                    <div class="col-sm-8">
                                        <div class="input-group">
                                            <input type="hidden" id="orgCode" name="orgCode" value="">
                                            <input type="text" id="orgName" name="orgName" value=""
                                                   class="form-control" maxlength="25" placeholder="输入所属医院">
                                            <div class="input-group-btn"
                                                 style="width:0px!important;border-radius:0px!important">
                                                <button type="button"
                                                        class="btn btn-default dropdown-toggle mySearchBtn"
                                                        data-toggle="dropdown">
                                                    <span class="caret"></span>
                                                </button>
                                                <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="row form-group">
                                    <div class="col-sm-3 text-right">查询专家：</div>
                                    <div class="col-sm-8">
                                        <div class="input-group">
                                            <input type="text" class="form-control" name="docName" id="ddocName"
                                                   placeholder="输入专家名称"
                                                   onkeydown="if(event.keyCode==13){doWinRefresh();return false;}"
                                            ><span class="input-group-btn"><button
                                                type="button"
                                                onclick="doWinRefresh()"
                                                class="btn btn-white">查询</button></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="row form-group">
                                    <div class="col-sm-3 text-right">数据来源：</div>
                                    <div class="col-sm-8">
                                        <div class="input-group">
                                            <input type="hidden" id="isvPid" name="isvPid" value="">
                                            <input type="text" id="isvPidName" name="isvPidName" value=""
                                                   class="form-control" maxlength="25" placeholder="输入数据来源">
                                            <div class="input-group-btn"
                                                 style="width:0px!important;border-radius:0px!important">
                                                <button type="button"
                                                        class="btn btn-default dropdown-toggle mySearchBtn"
                                                        data-toggle="dropdown">
                                                    <span class="caret"></span>
                                                </button>
                                                <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <table class='table table-striped table-hover'
                               id="WinTable"
                               data-toggle="table"
                        <%--data-url="${ctx}/bizApp/getGridOrgData?t=${now}"--%>
                               data-pagination="true"
                               data-side-pagination="server"
                               data-striped="true"
                               data-response-handler="handleServerResult"
                               data-query-params-type=""
                               data-query-params="getWinParams"
                               data-page-number="${not empty searchInfo.pageNo ? searchInfo.pageNo : 1}"
                               data-page-size="${defaultPageSize}"
                               data-page-list="${pageList}">
                            <thead>
                            <tr>
                                <th data-field="checkBx" data-checkbox="true" data-width="20px"></th>
                                <th data-field="docName" data-align="center" data-width="90px">专家名称</th>
                                <th data-field="orgName" data-align="center" data-width="90px">所属医院</th>
                                <th data-field="pDeptName" data-align="center" data-formatter="formatterpDeptName"  data-width="90px">一级科室</th>
                                <th data-field="cDeptName" data-align="center" data-formatter="formattercDeptName" data-width="90px">二级科室</th>
                                <th data-field="isvName" data-align="center" data-width="90px">数据来源</th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                </div>
                <div class="modal-footer" style="text-align: center;">
                    <button class="btn btn-primary" onclick="doSaveApp()">保存</button>
                    <button class="btn btn-white" onclick="$('#addBizApp').modal('hide')">取消</button>
                </div>
            </div>
        </div>
    </div>

    <div id="editBizApp" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content animated bounceInRight">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 id="_modelTitle" style="font-weight: normal;">编辑机构专家</h4>
                </div>
                <div class="modal-body modal-body-height">
                    <h4><i class="fa fa-table"></i> 基本信息</h4>
                    <hr>
                    <div class="row">
                        <label class="col-sm-3 text-right">业务类型：</label>
                        <div class="col-sm-3">{{editBizApp.bizName}}
                        </div>
                        <label class="col-sm-3 text-right">机构名称：</label>
                        <div class="col-sm-3">{{addBizApp.orgName}}
                        </div>
                    </div>
                    <div class="row">
                        <label class="col-sm-3 text-right">专家名称：</label>
                        <div class="col-sm-3">{{editBizApp.docName}}
                        </div>
                        <label class="col-sm-3 text-right">专家排序：</label>
                        <div class="col-sm-3">{{editBizApp.sortNum}}
                        </div>
                    </div>
                    <div class="row">
                        <label class="col-sm-3 text-right">服务商：</label>
                        <div class="col-sm-9">{{editBizApp.isvName}}
                        </div>
                    </div>
                </div>
                <div class="modal-footer" style="text-align: center;">
                    <button class="btn btn-primary" onclick="doEditApp()">保存</button>
                    <button class="btn btn-white" onclick="$('#editBizApp').modal('hide')">取消</button>
                </div>
            </div>
        </div>
    </div>

    <div id="publishApp" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content animated bounceInRight">
                <div class="modal-header text-center">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4>扫码验证</h4>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-sm-12 text-center"><image class="login-scancode" id="scanCode" style="height: auto;width: 250px" onclick="chageQRCode();"/></div>
                        <div class="col-sm-12 text-center">提示：验证发布内容准确性，上线更放心</div>
                        <div class="col-sm-12 text-center">二维码有效期为<span id="_validNum"></span>秒</div>
                    </div>
                </div>
                <div class="modal-footer" style="text-align: center;">
                    <button class="btn btn-primary" id="upPublish" data-loading-text="提交中..." onclick="doPublishApp()">提交发布</button>
                    <button class="btn btn-white" onclick="$('#publishApp').modal('hide')">取消</button>
                </div>
            </div>
        </div>
    </div>

    <div id="unPublishAppWin" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content animated bounceInRight">
                <div class="modal-header text-center">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4>撤销发布</h4>
                </div>
                <div class="modal-body modal-body-height">
                    <div class="row">
                        <div class="col-sm-1 text-right error"></div>
                        <div class="col-sm-11 text-left"><span style="color: red">*</span>请输入撤销发布原因</div>
                    </div>
                    <c:forEach items="${appOperReason}" var="item">
                        <div class="row">
                            <div class="col-sm-1 text-right"></div>
                            <div class="col-sm-11 text-left" ><label ><input type="checkbox" name="error_text" id="${item.dictName}" value="${item.dictName}">${item.dictName}</label></div>
                        </div>
                    </c:forEach>
                    <div class="row">
                        <div class="col-sm-1 text-right"></div>
                        <div class="col-sm-11 text-left">
                            <textarea id="error_textarea" name="error_textarea" cols="30" rows="10"
                                      class="form-control"></textarea>
                        </div>
                    </div>
                </div>
                <div class="modal-footer" style="text-align: center;">
                    <button class="btn btn-primary" onclick="doUnPublishApp()">撤销发布</button>
                    <button class="btn btn-white" onclick="$('#unPublishAppWin').modal('hide')">取消</button>
                </div>
            </div>
        </div>
    </div>


    <div id="delAppWin" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content animated bounceInRight">
                <div class="modal-header text-center">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4>删除</h4>
                </div>
                <div class="modal-body modal-body-height">
                    <div class="row">
                        <div class="col-sm-1 text-right error"></div>
                        <div class="col-sm-11 text-left"><span style="color: red">*</span>请输入删除原因</div>
                    </div>
                    <c:forEach items="${appOperReason}" var="item">
                        <div class="row">
                            <div class="col-sm-1 text-right"></div>
                            <div class="col-sm-11 text-left"><label ><input type="checkbox" name="del_text" id="${item.dictName}" value="${item.dictName}">${item.dictName}</label></div>
                        </div>
                    </c:forEach>
                    <div class="row">
                        <div class="col-sm-1 text-right"></div>
                        <div class="col-sm-11 text-left">
                            <textarea id="del_textarea" name="del_textarea" cols="30" rows="10"
                                      class="form-control"></textarea>
                        </div>
                    </div>
                </div>
                <div class="modal-footer" style="text-align: center;">
                    <button class="btn btn-primary" onclick="dodelApp()">删除</button>
                    <button class="btn btn-white" onclick="$('#delAppWin').modal('hide')">取消</button>
                </div>
            </div>
        </div>
    </div>
</div>

<%@ include file="../common/common-body.jsp" %>
<script src="${ctx}/js/app/bizDocMgr.js?t=${now}"></script>
</body>
</html>
